home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
CUGUK
/
COMMS
/
C100.ZIP
/
KERMIT.ZIP
/
CKVKER.SRC
< prev
next >
Wrap
Text File
|
1990-01-31
|
7KB
|
221 lines
Date: Tue, 16 Sep 86 09:44:36 pdt
From: varian!david@lll-crg.ARPA
Subject: Using C-Kermit on VAX/VMS for mail spooling.
We use C Kermit (058) under VMS here. I wrote some scripts that run kermit
unattended in order to send mail from UNIX to VMS.
::::::::::::::
README
::::::::::::::
5/2/86
These files allow you to transfer mail from a UNIX system to a VMS
system (or any other system running a kermit with advanced server
functions -- specifically, the remote host command).
On our leaf machines (madvax and vaxwaller), create aliases in
/usr/lib/aliases for all users that you wish to send mail to, and
just route mail to the gateway machine (varian):
shnell:varian!shnell
On the gateway machine, create an alias in /usr/lib/aliases to pipe
the standard input to a program (vmsspool) which will place the text
in an individual file (named user.pid) and append kermit commands for
sending the file and running "remote host mail" to a take script:
shnell:"!/usr/local/lib/vms/vmsspool lds shnell"
(first argument is vms system name; second argument is user name
on that VMS system)
/usr/lib/aliases is found on systems using sendmail and delivermail;
if you do not have these, you could write a front-end
shell script for your mail command, or create a special purpose vmsmail
command. It may be possible to set up your sendmail configuration file
to handle something like user@site.vmsdomain to avoid creating aliases
for every VMS user, but I don't know enough about sendmail to do this.
Sometime later, either invoked from crontab or from a modified version
of vmsspool (for immediate transmission), the vmsdaemon is started:
/usr/local/lib/vms/vmsdaemon lds
(one argument -- VMS system name)
This will:
1) Check to see if anything has been spooled up (the take script
is non-empty)
2) Using a take script specific for that VMS system in
/usr/local/lib/vms:
Calls up the system
Logs on as a specific ordinary user
Starts kermit in server mode on the VMS system
3) Runs the take script generated by vmsspool:
for each mail message
send text file
run mail on VMS
delete the file on VMS
delete the file on UNIX
4) Run a take script to exit kermit and logoff.
5) Check return code from kermit; if failure, keep the take
script for future retry; else delete it.
Unknown behavior -- the most common error I expect is failure
to connect or login, in which case the take script containing
"delete the file on UNIX" should not be run; if for some reason,
that script is run and the text files are deleted but kermit
returns an error code, then the take file will still be around
but the text files will be gone.
On the VMS machine, you will need:
1) A robust version of kermit, with server functions (at least "receive"
and "remote host"). I had problems using server mode with the BLISS-based
kermit (v3.1(066)), so I ended using ckermit (v4C(058)); if you don't
have a C compiler on your VMS machine, you should be able to obtain
a hex file of an executable; I believe that DEC has lifted the restriction
on distribution of binaries built with the C compiler.
(Hint: when I first tried C kermit on our VMS machine, I got garbage
characters for a prompt; it turned out the terminal was set for even
parity -- I changed it to none).
2) A login account. This can be any ordinary user account, but VMS users
who receive mail will see this name in the header, so it should be
something descriptive.
FUTURE:
I have not yet implemented sending mail back from VMS to UNIX.
My proposal is for the VMS user to reply to the login account which sent
him the mail (reply in mail should work OK) and place a
To: unix_user
in the text of his message. When vmsdaemon calls up VMS from UNIX,
it will (using script function of kermit) start up mail, extract all
messages into one or more text files, get those files back to UNIX,
and use a variant of recmail (a program supplied with bnews which will
send mail according to "To:" lines in a file) to send mail to the
appropriate user. The main shortcoming of recmail is that it sends
the entire message to all names on a "To:" line; we want to be able
to break up multiple messages, and also to ignore "To:" lines that
mention our VMS login.
::::::::::::::
vmsspool
::::::::::::::
:
# vmsspool:
# This will spool up mail to send to a VMS site via kermit
# It creates a file of send and remote host commands to be executed by
# the kermit take command.
#
# Usage:
# vmsspool VMSsystem VMSname
# Input is taken from standard input.
# It may be invoked from /usr/lib/aliases: user: | "spoolvms vsystem vuser"
DIR=/usr/spool/vms
SCRIPT=$DIR/$1
# VUSER = login name under VMS
VUSER=$2
# UFILE = name of data file under UNIX
UFILE=$DIR/$VUSER.$$
# VFILE = name of data file under VMS
VFILE=$VUSER.TXT
cat > $UFILE
echo "send $UFILE $VFILE" >> $SCRIPT
echo "remote host mail $VFILE $VUSER" >> $SCRIPT
echo "remote host delete $VFILE;1" >> $SCRIPT
echo "! rm $UFILE" >> $SCRIPT
::::::::::::::
vmsdaemon
::::::::::::::
:
# vmsdaemon - connect to a VMS system, start up a kermit server,
# execute the kermit commands in a specified take script
#
# Usage: vmsdaemon VMS-system-name
# (Note: the VMS system name will have the same name as the take-script)
#
# You will probably want to execute this from crontab or from vmsspool
# (if you want immediate transmission).
#
DIR=/usr/spool/vms
LIB=/usr/local/lib/vms
VSYSTEM=$1
SCRIPT=$DIR/$VSYSTEM
WORKSCRIPT=$DIR/$VSYSTEM.work
CONNECT=$LIB/$VSYSTEM
FINISH=$LIB/finish
PORT=/dev/tty00
SPEED=1200
KERMIT=/usr/local/bin/kermit
if test $# -ne 1
then
echo "Usage: vmsdaemon VMS-system-name"
exit 1
fi
if test -s $WORKSCRIPT
then
echo "Work script already exists"
exit 1
fi
if test -s $SCRIPT
then
cp $SCRIPT $WORKSCRIPT
echo -n > $SCRIPT
else
echo "No work"
exit 0
fi
$KERMIT -l $PORT -b $SPEED << EOF
take $CONNECT
take $WORKSCRIPT
take $FINISH
EOF
if test $? -eq 0
then
echo "Succeeded"
rm $WORKSCRIPT
exit 0
else
echo "Failed"
cat $WORKSCRIPT >> $SCRIPT
rm $WORKSCRIPT
exit 1
fi
::::::::::::::
lds
::::::::::::::
log trans
set modem-dialer hayes
dial PHONE-NUMBER
script name:--name:--name: %d%d%dVMS-LOGIN ssword: VMS-PASSWORD %w45$--$ \
kermit ermit>--ermit> server
::::::::::::::
finish
::::::::::::::
bye
script $--$ lo
-------